package cn.edu.scau.cmi.chenyaoquan.simpleFactoryMethod;


import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class SimpleFactoryController {
    @FXML
    private TextField meatTextField;

    @FXML
    private TextArea meatTextArea;

    @FXML
   public  void getMeat(ActionEvent event) {
    	String option="";
    	MeatFactory meatFactory  = new MeatFactory();
    	if(meatTextField.getText().compareTo("pork")==0) {
    		option = "pork";
    	}
    	if(meatTextField.getText().compareTo("beef")==0) {
    		option = "beef";
    	}
    	if(meatTextField.getText().compareTo("chicken")==0) {
    		option = "chicken";
    	}
    	Meat meat =  meatFactory.getMeatObj(option);	
    	meatTextArea.appendText(meat.getInfo());
 
    }
}
